package org.asg.dis.service;

import org.asg.dis.model.Complaint;
import org.asg.dis.model.ComplaintStatus;
import org.asg.dis.repository.ComplaintRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComplaintService {

    @Autowired
    private ComplaintRepository complaintRepository;

    // 创建投诉
    public Complaint createComplaint(Complaint complaint) {
        return complaintRepository.save(complaint);
    }

    public List<Complaint> getNewByStationId(Long stationId) {
        return complaintRepository.findByStationIdAndStatus(stationId, ComplaintStatus.未处理);
    }
}